<template>
  <div>
    <h2>土味情话</h2>
    <ul>
      <li v-for="(item) in list":key="item.id">{{ item.content }}</li>
    </ul>
    <button @click="add">增加</button>
  </div>
</template>

<script setup lang='ts' name="Talk">
import { ref, reactive } from 'vue'
import { useTalkStore } from '@/stores/talk';
import { storeToRefs } from 'pinia';


const TalkStore = useTalkStore()

let {list} = storeToRefs(TalkStore)

TalkStore.$subscribe((munn,state) => {
  // console.log(munn,1,"修改前的值");
  // console.log(state,2,"修改后的值");
  localStorage.setItem("TalkMain",JSON.stringify(list))
  
})

function add(){
  TalkStore.getList()
}

</script>


<style lang='scss' scoped>

</style>